$(function(){
	ShowTabl();
});
function WalletSel(){
	ShowTabl();
}

function ShowTabl(){
	var user = document.getElementById("userid").value;
	//alert(user);
	var url = ""
	if(user==""||user==null){
		url = "coustomerflow/all.do"
	}else{
		user=encodeURI(encodeURI(user));
		url = "coustomerflow/selectById.do?account="+user;
	}
	
	var tableSource = new $.jqx.dataAdapter({
		dataType: "json",
		dataFields:[
		    { name: "id",type:"int"},
		    { name: "account", type: "string" },
		    { name: "name", type: "string" },
		    { name: "money", type: "string" },
		    { name: "order_sn", type: "string" },
		    { name: "order_time", type: "date" },
		    { name: "pay_code",type:"string"},
		    { name: "trade_sn",type:"string"},
		    { name: "trade_status",type:"string"},
		    { name: "trade_time",type:"date"},
		    { name: "order_status",type:"string"}
		],
		id: "id",
		url:url
	});
	ShowTableData(tableSource);
	
}
function ShowTableData(tableSource){
	$("#dataTable").jqxDataTable({
		width: "100%",
        source: tableSource,
        pageable: true,
        pageSize: 15,
        serverProcessing: true,
        pagerButtonsCount: 10,
        columnsResize: true,
        sortable: true,
        columns: [
            { text: "序号", width: 50, cellsRenderer: function(row) { return (row + 1).toString(); } },
            { text: "账户名",dataField:"account"},
            { text:	"用户名称",dataField:"name"},
            { text: "交易金额",dataField:"money"},
            { text: "订单号",dataField:"order_sn"},
            { text: "支付方式",dataField:"pay_code"},
            { text: "交易时间",dataField:"trade_time",
            	cellsRenderer: function(row, column, value, rowData) {
            		return format(value, "Y-M-D H:I");
            	}}
        ],
	});
}



